package pa2.util;

import java.io.File;
import java.io.IOException;
import java.util.Locale;

import jxl.CellView;
import jxl.Workbook;
import jxl.WorkbookSettings;
import jxl.format.UnderlineStyle;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;
import jxl.write.Number;

public class ExcelWrite {
	private String inputFile;
	private File file;
	WorkbookSettings wbSettings;
	WritableWorkbook workbook;
	WritableSheet excelSheet;

	public ExcelWrite(){
		
	}
	
	public String getInputFile() {
		return inputFile;
	}

	public void setInputFile(String inputFile) throws IOException {
		file = new File(inputFile);
		wbSettings = new WorkbookSettings();
		workbook = Workbook.createWorkbook(file, wbSettings);
		workbook.createSheet("Report", 0);
		excelSheet = workbook.getSheet(0);
	}
	
	public void save() throws IOException, WriteException{
		workbook.write();
		workbook.close();
	}
	
	public void addNumber(int column, int row,
			Long longValue) throws WriteException, RowsExceededException {
		Number number;
		number = new Number(column, row, longValue);

		excelSheet.addCell(number);
	}


}
